package org.example.finalsecurities.controller;

import org.example.finalsecurities.entity.Result;
import org.example.finalsecurities.entity.StockAlert;
import org.example.finalsecurities.service.AlertService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author : [Pashm]
 * @version : [v1.0]
 */
@RestController
@RequestMapping("/api/alert")
public class AlertController {
    @Autowired
    public AlertService alertService;

    @RequestMapping("/all")
    public Result<List<StockAlert>> selectAll(){

        return Result.success(alertService.selectAll());

    }
    @RequestMapping("/fetch")
    public void fetch(){
        alertService.fetchAndUpdateAlert();
    }
}
